<html>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at
 
  http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<head>
<title>Hello World JavaScript Client Sample</title>
<!-- Generate and retrieve a JavaScript client for the server. -->
<script type="text/javascript" src="/SoapContext/SoapPort?js"></script>
<script type="text/javascript">
<!-- create an object that talks to the Greeter service. -->
var Greeter = new apache_org_hello_world_soap_http_Greeter();
<!-- set the URL for the service. No cross-scripting allowed. -->
Greeter.url = "/SoapContext/SoapPort";

var responseSpan;

// This is the function called upon success.
function sayHiResponse(response, span)
{
    span.firstChild.nodeValue = response.getResponseType();
}

// This is the function called for an error.

function sayHiError(error)
{
      alert('error ' + error);
}

// This function is invoked from the button press to run the service. 
function invokeSayHi()
{
    responseSpan1 = document.getElementById('sayHiResponse1');
    responseSpan1.firstChild.nodeValue = " - pending - ";
    responseSpan2 = document.getElementById('sayHiResponse2');
    responseSpan2.firstChild.nodeValue = " - pending - ";
    var receiveFirstResponse = function(response) { sayHiResponse(response, responseSpan1); };
    Greeter.sayHi(receiveFirstResponse, sayHiError);
    var receiveSecondResponse = function(response) { sayHiResponse(response, responseSpan2); };
    Greeter.sayHi(receiveSecondResponse, sayHiError);
}
</script>
</head>
<body>
<h1>
Hello World Sample
</h1>
<form>
<div>
	<table>
	  <tr>
	    <td>Run sayHi</td>
	    <td><input type="button" 
                       value="invoke" name="sayHi" 
		       onClick="invokeSayHi()">
	  </tr>
	  <tr>
	    <td>sayHi response 1</td>
	    <td><span id='sayHiResponse1'>- not yet invoked -</span></td>
	  </tr>
	  <tr>
	    <td>sayHi response 2</td>
	    <td><span id='sayHiResponse2'>- not yet invoked -</span></td>
	  </tr>
	</table>
</div>
</form>
</body>
</html>